package com.ali.stock.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ali.stock.domain.SysDeal;
import com.ali.stock.service.SysDealService;
import com.ali.stock.mapper.SysDealMapper;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
* @author Administrator
* @description 针对表【sys_deal(成交(交易)信息表)】的数据库操作Service实现
* @createDate 2024-03-28 11:26:57
*/
@Service
public class SysDealServiceImpl extends ServiceImpl<SysDealMapper, SysDeal>
    implements SysDealService{

    @Override
    public List<SysDeal> getHistoryDealList(SysDeal sysDeal) {
        return this.baseMapper.getHistoryDealList(sysDeal);
    }

    @Override
    public List<SysDeal> getTodayDealList(SysDeal sysDeal) {
        return this.baseMapper.getTodayDealList(sysDeal);
    }

//    @Override
//    public List<SysDeal> getTodayDealList(SysDeal sysDeal) {
//        List<SysDeal> historyDealList = this.getHistoryDealList(sysDeal);
//        List<SysDeal> sysDealList = new ArrayList<>();
//        for (SysDeal deal : historyDealList) {
//            Date dealTime = deal.getDealTime();
//            Calendar instance = Calendar.getInstance();
//            instance.add(Calendar.DAY_OF_MONTH,-1);
//            Date time = instance.getTime();
//            if(dealTime.compareTo(time)!=0){
//                sysDealList.add(sysDeal);
//            }
//
//        }
//        return sysDealList;
//    }
}




